package com.ruoyi.web.controller.dispatch;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.DispatchMapPipeline;
import com.ruoyi.system.service.IDispatchMapPipelineService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 地图管线信息Controller
 * 
 * @author ruoyi
 * @date 2025-03-02
 */
@RestController
@RequestMapping("/system/dispatchMapPipeline")
public class DispatchMapPipelineController extends BaseController
{
    @Autowired
    private IDispatchMapPipelineService dispatchMapPipelineService;

    /**
     * 查询地图管线信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMapPipeline:list')")
    @GetMapping("/list")
    public TableDataInfo list(DispatchMapPipeline dispatchMapPipeline)
    {
        startPage();
        List<DispatchMapPipeline> list = dispatchMapPipelineService.selectDispatchMapPipelineList(dispatchMapPipeline);
        return getDataTable(list);
    }

    /**
     * 导出地图管线信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMapPipeline:export')")
    @Log(title = "地图管线信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DispatchMapPipeline dispatchMapPipeline)
    {
        List<DispatchMapPipeline> list = dispatchMapPipelineService.selectDispatchMapPipelineList(dispatchMapPipeline);
        ExcelUtil<DispatchMapPipeline> util = new ExcelUtil<DispatchMapPipeline>(DispatchMapPipeline.class);
        util.exportExcel(response, list, "地图管线信息数据");
    }

    /**
     * 获取地图管线信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMapPipeline:query')")
    @GetMapping(value = "/{pipeId}")
    public AjaxResult getInfo(@PathVariable("pipeId") Long pipeId)
    {
        return success(dispatchMapPipelineService.selectDispatchMapPipelineByPipeId(pipeId));
    }

    /**
     * 新增地图管线信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMapPipeline:add')")
    @Log(title = "地图管线信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DispatchMapPipeline dispatchMapPipeline)
    {
        return toAjax(dispatchMapPipelineService.insertDispatchMapPipeline(dispatchMapPipeline));
    }

    /**
     * 修改地图管线信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMapPipeline:edit')")
    @Log(title = "地图管线信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DispatchMapPipeline dispatchMapPipeline)
    {
        return toAjax(dispatchMapPipelineService.updateDispatchMapPipeline(dispatchMapPipeline));
    }

    /**
     * 删除地图管线信息
     */
    @PreAuthorize("@ss.hasPermi('system:dispatchMapPipeline:remove')")
    @Log(title = "地图管线信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pipeIds}")
    public AjaxResult remove(@PathVariable Long[] pipeIds)
    {
        return toAjax(dispatchMapPipelineService.deleteDispatchMapPipelineByPipeIds(pipeIds));
    }
}
